using System;
using System.Collections;
using UnityEngine;

public static class BlockPopupTransition
{
	public static void PopupAnimation(Action callback)
	{
		if (BlockPopupTransition.popupTransition == null)
		{
			BlockPopupTransition.popupTransition = new FadeTransition();
		}
		TaskManager.StartCoroutine(BlockPopupTransition.CoPopupAnimation(callback));
	}

	private static IEnumerator CoPopupAnimation(Action callback)
	{
		Scene.Lock();
		TaskManager.StartCoroutine(BlockPopupTransition.popupTransition.CoTransitionOut(0.5f));
		yield return new WaitForSeconds(0.5f);
		if (callback != null)
		{
			callback();
		}
		TaskManager.StartCoroutine(BlockPopupTransition.popupTransition.CoTransitionIn(0.5f));
		yield return new WaitForSeconds(0.5f);
		Scene.Unlock();
		yield break;
	}

	private static Transition popupTransition;
}
